import java.util.Scanner;

/**
 * @author 8zhazha8
 * @create 2021-04-24-20:13
 */
public class HomeWork1 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请在以下几何图形中输入你要计算的形状");
        System.out.println("1.三角形");
        System.out.println("2.正方形");
        System.out.println("3.长方形");

        String select = input.next();

            if(select.equals("三角形"))
            {
                System.out.println("输入底");
                float side1=input.nextFloat();
                System.out.println("输入高");
                float side2=input.nextFloat();
                float s=triangle(side1, side2);
                System.out.println("面积是："+s);
            }
            if(select.equals("正方形"))
            {
                System.out.println("输入边");
                float side1=input.nextFloat();
                System.out.println("输入边");
                float side2=input.nextFloat();
                float s=square(side1, side2);
                System.out.println("面积是："+s);
            }
            if(select.equals("长方形"))
            {
                System.out.println("输入长");
                float side1=input.nextFloat();
                System.out.println("输入宽");
                float side2=input.nextFloat();
                float s=rectangle(side1, side2);
                System.out.println("面积是："+s);
            }
    }
    public static float triangle(float side1,float side2) {
        //三角形
        float s=0;
        s=(side1*side2)/2;
        return s;
    }
    public static float square(float side1,float side2) {
        //正方形
        float s=0;
        s=side1*side2;
        return s;
    }
    public static float rectangle(float side1,float side2) {
        //长方形
        float s=0;
        s=side1*side2;
        return s;
    }
}
